/*
 PureMVC AS3 / Flex Demo - Slacker 
 Copyright (c) 2008 Clifford Hall <clifford.hall@puremvc.org>
 Your reuse is governed by the Creative Commons Attribution 3.0 License
 */
package mvc.view
{
	import flash.events.Event;

	import mvc.ApplicationFacade;
	import mvc.view.components.DefaultView;

	import org.tools.att.Att;
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class ApplicationMediator extends Mediator
	{
		public static const NAME:String = 'ApplicationMediator';

		private	function	onTrace(...args):void{Att.send('onTrace',String(Object(this).constructor),args);}

		public function ApplicationMediator( viewComponent:Object )
		{
			onTrace('	constructor	'+this);
			super( NAME, viewComponent );
		}
		override public function onRegister():void
		{
			onTrace('	onRegister	'+app);
			facade.registerMediator(new MainDisplayMediator( app.mainDisplay));
		    app.addEventListener( DefaultView.SHOW_SPLASH,		onShowSplash);
		    app.addEventListener( DefaultView.SHOW_ABOUT,		onShowAbout);
		    app.addEventListener( DefaultView.SHOW_ART,			onShowArt);
		    app.addEventListener( DefaultView.SHOW_COLL,		onShowColl);
		    app.addEventListener( DefaultView.SHOW_CONTACT,		onShowContact);
		} 
		protected function onShowSplash( event:Event ):void	{sendNotification( ApplicationFacade.SPLASH_MODE );}
		protected function onShowAbout( event:Event ):void	{sendNotification( ApplicationFacade.ABOUT_MODE );}
		protected function onShowArt( event:Event ):void	{sendNotification( ApplicationFacade.ART_MODE );}
		protected function onShowColl( event:Event ):void	{sendNotification( ApplicationFacade.COLL_MODE );}
		protected function onShowContact( event:Event ):void{sendNotification( ApplicationFacade.CONTACT_MODE );}
		protected function get app():ArtG	{return viewComponent as ArtG;}
	}
}